<%@ Control Language="C#" AutoEventWireup="true" CodeFile="DntEndorsementRating.ascx.cs" Inherits="includes_DntEndorsementRating" %>
<script>
<!--
// this script change the rollover images 
var org<%=this.ID%>=<%=FullRate%>;//orginal rating
var orgHalf<%=this.ID%>="<%=halfRate%>";
//alert(org<%=this.ID%>)
//alert(orgHalf<%=this.ID%>)
var orgClick<%=this.ID%>="no";
var imageN<%=this.ID%>="<%=this.imageName%>"

    if (document.images) 
    {
        normalImageSrc<%=this.ID%>      = new Image();        
        RatingRollOverImageSrc<%=this.ID%>     = new Image() ;
        normalHalfImageSrc<%=this.ID%>= new Image();
        if(imageN<%=this.ID%>=="plus")
        {
        //alert(1)
        RatingRollOverImageSrc<%=this.ID%>.src = "<%=Session["strHttp"]+"images/"%>tick.png" ;            
        normalImageSrc<%=this.ID%>.src   = "<%=Session["strHttp"]+"images/"%>white-plus-sign.gif" ;
        normalHalfImageSrc<%=this.ID%>.src   = "<%=Session["strHttp"]+"images/"%>plus-icon-rw.gif" ;
        }
        else
        {
        //alert(2)
        RatingRollOverImageSrc<%=this.ID%>.src = "<%=Session["strHttp"]+"images/"%>dollor-sign-img.gif" ;            
        normalImageSrc<%=this.ID%>.src   = "<%=Session["strHttp"]+"images/"%>white-plus-sign.gif" ;
        normalHalfImageSrc<%=this.ID%>.src   = "<%=Session["strHttp"]+"images/"%>plus-icon-rw.gif" ;
        }
    }


function toRateImage<%=this.ID%>(buttonname)
{
    if (document.images) {
     document.getElementById(buttonname).src =RatingRollOverImageSrc<%=this.ID%>.src; 
    }
}
function normalImage<%=this.ID%>(buttonname)
{
    if (document.images) {
     document.getElementById(buttonname).src =normalImageSrc<%=this.ID%>.src;
    }
}
// -->
function rotateOtherImages<%=this.ID%>(j)
{
    //imagesBlank();
    for(ii=1;ii<=j;ii++)    
        toRateImage<%=this.ID%>("rank<%=this.ID%>"+ii)    
    for(k=eval(j)+1;k<=5;k++)        
        normalImage<%=this.ID%>("rank<%=this.ID%>"+k)    
}
function orignalImages<%=this.ID%>(org)
{
if(org)
{
org<%=this.ID%>=selectCross(org); 
orgClick<%=this.ID%>="yes";
}
    for(ii=1;ii<=eval(org<%=this.ID%>);ii++)    
        toRateImage<%=this.ID%>("rank<%=this.ID%>"+ii)    
    for(k=eval(org<%=this.ID%>)+1;k<=5;k++)        
        normalImage<%=this.ID%>("rank<%=this.ID%>"+k)            
        
    //alert(orgClick<%=this.ID%>)
 if(orgClick<%=this.ID%>=="no")
 {    
        if(orgHalf<%=this.ID%>=="True")
        {
            document.getElementById("rank<%=this.ID%>"+(eval(org<%=this.ID%>+1))).src=normalHalfImageSrc<%=this.ID%>.src;        
        } 
  }
}
function selectCross(Rating)
    {
    return Rating;
        /*if (Rating > 90 && Rating <= 100)
            return 5;
        else if (Rating > 80 && Rating <= 90)
            return 4;
        else if (Rating > 70 && Rating <= 80)
            return 3;
        else if (Rating > 40 && Rating <= 70)
            return 2;
        else 
            return 1;*/
    }
   function saving<%=this.ID%>(rt)
   {
   eval("sp<%=this.ID%>").innerText="Saving...";   
   setTimeout("CallServer<%=this.ID%>("+rt+")",1000);
   }
   
</script>
<span onmouseout="orignalImages<%=this.ID%>()">
<a href="#" onclick="saving<%=this.ID%>(1);orignalImages<%=this.ID%>(1);return false;" onmouseover="rotateOtherImages<%=this.ID%>('1')"  title="Click to rate Poor"><img alt="Click to rate Poor" src="" id="rank<%=this.ID%>1" border="0" /></a>
<a href="#" onclick="saving<%=this.ID%>(2);orignalImages<%=this.ID%>(2);return false;" onmouseover="rotateOtherImages<%=this.ID%>('2')"   title="Click to rate Fair"><img alt="Click to rate Fair" src="" id="rank<%=this.ID%>2" border="0" /></a>
<a href="#" onclick="saving<%=this.ID%>(3);orignalImages<%=this.ID%>(3);return false;" onmouseover="rotateOtherImages<%=this.ID%>('3')"   title="Click to rate Good"><img alt="Click to rate Good" src="" id="rank<%=this.ID%>3" border="0" /></a>
<a href="#" onclick="saving<%=this.ID%>(4);orignalImages<%=this.ID%>(4);return false;" onmouseover="rotateOtherImages<%=this.ID%>('4')"  title="Click to rate Very Good"><img alt="Click to rate Very Good" src="" id="rank<%=this.ID%>4" border="0" /></a>
<a href="#" onclick="saving<%=this.ID%>(5);orignalImages<%=this.ID%>(5);return false;" onmouseover="rotateOtherImages<%=this.ID%>('5')" title="Click to rate Excellent"><img alt="Click to rate Excellent" src="" id="rank<%=this.ID%>5" border="0" /></a>
</span>
<span id="sp<%=this.ID%>"></span>
<script>
orignalImages<%=this.ID%>()
function ReceiveServerData<%=this.ID%>(arg, context)
{ 
//alert(arg);   
    //org<%=this.ID%>=arg;
//    orignalImages<%=this.ID%>();
//    eval("<%=this.ID%>").innerText =selectCross(arg);
    
//    org<%=this.ID%>=selectCross(arg);
//return false;
eval("sp<%=this.ID%>").innerText="";
}
</script>
<div>
</div>


